package org.dromara.web.controller.app;

import cn.dev33.satoken.annotation.SaIgnore;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.validation.constraints.NotNull;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.idempotent.annotation.RepeatSubmit;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.web.core.BaseController;
import org.dromara.dao.business.domain.UserTypeSetting;
import org.dromara.dao.business.domain.UserTypeSettingQuery;
import org.dromara.web.domain.app.UserTypeReq;
import org.dromara.web.domain.vo.RemoveRequest;
import org.dromara.web.service.business.UserTypeSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Objects;


/**
 * 用户套餐配置
 *
 * @date 2025-01-13 09:44:59
 */
@Validated
@RestController
@RequestMapping("/app/userTypeSetting")
public class AppUserTypeSettingController extends BaseController {

    @Autowired
    private UserTypeSettingService userTypeSettingService;


    /**
     *  获取套餐配置列表
     *
     * @return
     */
    @SaIgnore
    @Operation
    @GetMapping("/list")
    public R<List<UserTypeSetting>> findAll() {
        return R.ok(userTypeSettingService.getValidSettings());
    }



    @PostMapping("/order")
    public R<Object> order(@RequestBody UserTypeReq.UserTypeOrderReq req) {

        return R.ok(userTypeSettingService.userTypeOrder(req));
    }

}
